import React, { Fragment } from "react";
import { AppHeader, AppMenu, AppNav, AppFooter } from "@/components/";
import "./index.less";
import { connect } from "dva";
import { history } from "umi";
import Loading from "@/components/PageLoading/";

const App = (props) => {
  const { children, $app, routes } = props;
  const { menuCollapsed } = $app;
  const className = menuCollapsed ? "collapsed" : "expand";
  // console.log(props);
  // history.replace('/login')
  return (
    <Fragment>
      <div className={`app-left-part ${className}`}>
        <AppMenu routes={routes}></AppMenu>
      </div>
      <div className={`app-right-part ${className}`}>
        <AppHeader></AppHeader>
        <AppNav></AppNav>
        <main className="main">
          <div className="container">{children}</div>
          <AppFooter></AppFooter>
        </main>
      </div>
    </Fragment>
  );
};

export default connect((m) => m)(App);
